/**
* @package Scribble
*/
$(document).ready(function() {

	// Add functionality to "read more" links
	$('td.col-comment a[rel=readfulltext]').click(function() {
		$(this).parents('p').next('div').toggle();
		$(this).parents('p').toggle();
	});

	// Create date pickers
	$('#filter-df').datepicker({
		changeMonth: true,
		changeYear: true,
		dateFormat: 'dd/mm/yy',
		duration: '',
		onSelect: function(d, el) {
			d = d.replace(/^0/, '').replace(/\/0/, '/').split('/');
			$('#filter-dt').datepicker('option', 'minDate', new Date(d[2], parseInt(d[1])-1, parseInt(d[0])+1));
		}
	});
	var d = $('#filter-df').val().replace(/^0/, '').replace(/\/0/, '/').split('/');
	$('#filter-dt').datepicker({
		changeMonth: true,
		changeYear: true,
		dateFormat: 'dd/mm/yy',
		duration: '',
		minDate: new Date(d[2], parseInt(d[1])-1, parseInt(d[0])+1)
	});
});